package com.xy.biz.mes.domain.converter;

import com.xy.biz.mes.domain.bo.ManufactureTaskRecordBO;
import com.xy.biz.mes.domain.po.ManufactureTaskRecordPO;
import com.xy.biz.mes.domain.req.SaveManufactureTaskRecordRequest;
import com.xy.biz.mes.domain.resp.GetManufactureTaskRecordResponse;
import com.xy.tool.util.BeanUtilsEx;

import java.util.Collection;
import java.util.List;

/**
 *
 *
 * @author zsp
 * @date 2022-1-6
 */
public class ManufactureTaskRecordConverter {

	public static ManufactureTaskRecordPO toPO(ManufactureTaskRecordBO source) {
		return BeanUtilsEx.copyProperties(source, () -> new ManufactureTaskRecordPO(), true);
	}

	public static List<ManufactureTaskRecordPO> toPO(Collection<ManufactureTaskRecordBO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new ManufactureTaskRecordPO(), true);
	}

	public static ManufactureTaskRecordBO fromPO(ManufactureTaskRecordPO source) {
		return BeanUtilsEx.copyProperties(source, () -> new ManufactureTaskRecordBO());
	}

	public static List<ManufactureTaskRecordBO> fromPO(Collection<ManufactureTaskRecordPO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new ManufactureTaskRecordBO());
	}

	public static ManufactureTaskRecordBO toBO(SaveManufactureTaskRecordRequest source) {
		return BeanUtilsEx.copyProperties(source, () -> new ManufactureTaskRecordBO(), true);
	}

	public static List<ManufactureTaskRecordBO> toBO(Collection<SaveManufactureTaskRecordRequest> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new ManufactureTaskRecordBO(), true);
	}

	public static GetManufactureTaskRecordResponse toResponse(ManufactureTaskRecordBO source) {
		return BeanUtilsEx.copyProperties(source, () -> new GetManufactureTaskRecordResponse());
	}

	public static List<GetManufactureTaskRecordResponse> toResponse(Collection<ManufactureTaskRecordBO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new GetManufactureTaskRecordResponse());
	}

}
